package pixelwaks.gui.impl;

import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.io.IOException;

import javax.swing.JPanel;
import javax.swing.border.Border;

import common.util.FileHandler;


public class SettingsPanel extends JPanel {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String maps;
	
	private JPanel eSettingsPanel;
	
	public SettingsPanel(String maps) {
		this.maps = maps;
		initComponents();
	}

	private void initComponents() {
		eSettingsPanel = new EditSettingsPanel(maps);
		// how to use BackgroundBorder to set a background image
		try {
			Border border = new BackgroundBorder(FileHandler.getImage("", "splash.png"));
			setBorder(border);
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		
		GridBagLayout layout = new GridBagLayout();
		GridBagConstraints c = new GridBagConstraints();
				
		setLayout(layout);
		
		c.anchor = GridBagConstraints.CENTER;
		c.weightx = 1;
		c.weighty = 1;
		
		add(eSettingsPanel, c);
		
		setVisible(true);
		setPreferredSize(new Dimension(MainFrame.WIDTH_ON_WINDOW,MainFrame.HEIGHT_ON_WINDOW));
	}
}
